import { addNameSpace } from './util'

const NAME_SPACE = 'SIGN'

const addPrefix = addNameSpace(NAME_SPACE)

// 设置签名名称
export const SET_SIGN = addPrefix('SET_SIGN')

// 设置状态
export const SET_STATUS = addPrefix('SET_STATUS')

// 设置开始时间
export const SET_START_TIME = addPrefix('SET_START_TIME')

// 设置开始时间
export const SET_END_TIME = addPrefix('SET_END_TIME')

// 获取签名
export const GET_DATA = addPrefix('GET_DATA')

// 获取签名成功
export const GET_DATA_SUCCESS = addPrefix('GET_DATA_SUCCESS')

// 获取签名失败
export const GET_DATA_FAIL = addPrefix('GET_DATA_FAIL')

// 删除签名
export const DELETE_SIGN = addPrefix('DELETE_SIGN')

// 删除签名成功
export const DELETE_SIGN_SUCCESS = addPrefix('DELETE_SIGN_SUCCESS')

// 删除签名失败
export const DELETE_SIGN_FAIL = addPrefix('DELETE_SIGN_FAIL')

// 设置默认
export const SET_DEFAULT = addPrefix('SET_DEFAULT')

// 设置默认成功
export const SET_DEFAULT_SUCCESS = addPrefix('SET_DEFAULT_SUCCESS')

// 设置默认失败
export const SET_DEFAULT_FAIL = addPrefix('SET_DEFAULT_FAIL')

// 设置page num
export const SET_PAGE_NUM = addPrefix('SET_PAGE_NUM')

export const setSign = (sign) => ({ type: SET_SIGN, sign })

export const setStatus = (status) => ({ type: SET_STATUS, status })

export const setStartTime = (startTime) => ({ type: SET_START_TIME, startTime })

export const setEndTime = (endTime) => ({ type: SET_END_TIME, endTime })

export const getData = () => ({ type: GET_DATA })

export const getDataSuccess = (data) => ({ type: GET_DATA_SUCCESS, data })

export const getDataFail = () => ({ type: GET_DATA_FAIL })

export const deleteSign = (data) => ({ type: DELETE_SIGN, data })

export const deleteSignSuccess = () => ({ type: DELETE_SIGN_SUCCESS })

export const deleteSignFail = () => ({ type: DELETE_SIGN_FAIL })

export const setDefault = (data) => ({ type: SET_DEFAULT, data })

export const setDefaultSuccess = () => ({ type: SET_DEFAULT_SUCCESS })

export const setDefaultFail = () => ({ type: SET_DEFAULT_FAIL })

export const setPageNum = (pageNum) => ({ type: SET_PAGE_NUM, pageNum })

export default {
  setSign,
  setStatus,
  setStartTime,
  setEndTime,
  getData,
  getDataSuccess,
  getDataFail,
  deleteSign,
  deleteSignSuccess,
  deleteSignFail,
  setDefault,
  setDefaultSuccess,
  setDefaultFail,
  setPageNum,
}